﻿using System;
using System.IO;
using CHMCommon;

namespace CHM_DecompileApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var chm_file = Path.GetFullPath("./../../../htmlhelp.chm");
            if (File.Exists(chm_file))
            {
                var dir = Path.GetDirectoryName(chm_file);

                var filename = Path.GetFileNameWithoutExtension(chm_file);

                var dec_dir = Path.Combine(dir, filename);

                if (Directory.Exists(dec_dir))
                {
                    Directory.Delete(dec_dir);
                }
                Directory.CreateDirectory(dec_dir);

                var cmd = "-decompile " + dec_dir + " " + chm_file;
                try
                {
                    //hh.exe 默认在  C:\Windows 
                    var res = Util.StartRun("hh.exe", cmd);
                }
                catch (Exception ex)
                {

                }

            }

        }
    }
}
